
public class Person {
    //成员属性 姓名
    private String name;
    //成员属性 年龄
    private int age;
    //成员属性 性别
    private String sex;

    //get\set方法
    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getSex() {
        return sex;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    //无参构造器
    public Person(){

    }

    //全参构造器
    public Person(String name,int age,String sex){
        this.name=name;
        this.age=age;
        this.sex=sex;
    }

    //两参构造器
    public Person(String name,int age){
        this.name=name;
        this.age=age;
    }

    //一参构造器
    public Person(String name){
        this.name=name;
    }

    public void show(){
        System.out.println("name:"+name+"  age:"+age+"  sex:"+sex);
    }
}
